#ifndef CLIPGEOMTRYVIEW_H_VIEWHHGXK
#define CLIPGEOMTRYVIEW_H_VIEWHHGXK


#include "../../../../kegui_global.h"

#include <QVBoxLayout>
#include <QWidget>
#include <QPaintEvent>
#include <QFont>
#include <QPointF>

#include "kesyssetting.h"
#include "mcore/map/MapObject.h"
#include "mcore/tools//normal/DrawTool.h"

#include "ClipContextData.h"

#include <geostyle/styling/UserStyle.h>

#include <geos.h>

namespace kepen {
namespace core {

class ClipToolBar;
class KEGUI_EXPORT ClipGeomtryView : public QVBoxLayout
{
    Q_OBJECT
public:
    explicit ClipGeomtryView(QWidget *parent,KeSysSetting *config);
    ~ClipGeomtryView();
public:
    int onComboxClicked(int id,int flag,const QPoint &point);
    int onBtnClicked(int id);
    void repaintToolBar();
private:
    std::unique_ptr<geos::geom::Polygon> initRectRence(const geos::geom::Geometry  *geom);
    void  onEditToolSelectedImpl(int id);
    void  onAffineToolSelectedImpl(int id);
    void  onDrawToolSelectedImpl(int id);

    void doActDrawToolImpl(kepen::core::DrawTool::DrawType nDrawType);
    void doClipGeometry();
    void doViewGoback();
private Q_SLOTS:
    void onSelectedEditTool(QWidget *dlg,int id);
    void onSelectedAffineTool(QWidget *dlg,int id);
    void onSelectedDrawTool(QWidget *dlg,int id,int data);
    void timeoutClosedThiz();

    void onDrawCompletedHandler(kepen::core::DrawTool *tool);
private:
    void actEditTool(int id,bool checkView);
public:
    kepen::core::MapObject *mapSurface;
    KeSysSetting *sysConfig;
    QFont fontLabel;
    QFont thirdFontIcon;
    ClipContextData *lpContextData;
    ClipToolBar *toolBarHead;
    ClipToolBar *toolBarEdit;
    std::unique_ptr<geos::geom::Geometry> mGeomBase;


Q_SIGNALS:
    void onViewTabClosedSignals(QLayout *dlg);
};

}
}
#endif // CLIPGEOMTRYVIEW_H
